<?php

namespace App\Http\Controllers;

use Workerman\Worker;
use Illuminate\Http\Request;


class TestController extends Controller
{

    public function worker1()
    {
        $http_worker = new Worker("http://0.0.0.0:2345");
        // 4 processes
        $http_worker->count = 4;
        // Emitted when data received
        $http_worker->onMessage = function($connection, $data)
        {
            // $_GET, $_POST, $_COOKIE, $_SESSION, $_SERVER, $_FILES are available
            var_dump($_GET, $_POST, $_COOKIE, $_SESSION, $_SERVER, $_FILES);
            // send data to client
            $connection->send("hello world workerman \n");
        };

        // run all workers
        Worker::runAll();

    }
    public function index()
    {
        echo 'hello xiaowan';
    }

    public function param($id)
    {

        echo 'hello dana'.$id;
    }

    public function moreParam($sid,$pid)
    {
        echo 'hello dana'.$sid.' and '.$pid;
    }


}
